package com.xdl.flytest.service;

import com.xdl.flytest.bean.SystemUser;
import com.xdl.flytest.dao.SystemUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: 80736
 * @Date: 2018/12/26 21:08
 * @Description:
 */

@Service
public class UserService {

    @Autowired
    private SystemUserMapper userMapper;

    public SystemUser getUserByEmail(String email) {
        return userMapper.selectByEmail(email);
    }

    public void addUser(SystemUser user) {
        userMapper.insert(user);
    }

    public void updateUser(SystemUser user) {
        userMapper.updateByEmailSelective(user);
    }

    public void deleteUser(String email) {
        userMapper.deleteByEmail(email);
    }

    public List<SystemUser> getUsers() {
        return userMapper.selectUsers();
    }

    public void deleteUserById(Integer id) {
        userMapper.deleteByPrimaryKey(id);
    }
}
